﻿@page
@{ Layout = "_Layout"; }

<el-form :inline="true">
  <el-form-item label="栏目名称">
    <el-input v-model="filterText" size="mini" placeholder="输入栏目进行过滤"></el-input>
  </el-form-item>
  <el-form-item label="栏目模板" v-if="channelTemplates && channelTemplates.length > 0">
    <el-select v-model="filterChannelTemplateId" size="mini" placeholder="选择栏目模板进行过滤">
      <el-option label="<无筛选>" :value="0"></el-option>
      <el-option v-for="channelTemplate in channelTemplates" :key="channelTemplate.id" :label="channelTemplate.templateName" :value="channelTemplate.id"></el-option>
    </el-select>
  </el-form-item>
  <el-form-item label="内容模板" v-if="contentTemplates && contentTemplates.length > 0">
    <el-select v-model="filterContentTemplateId" size="mini" placeholder="选择内容模板进行过滤">
      <el-option label="<无筛选>" :value="0"></el-option>
      <el-option v-for="contentTemplate in contentTemplates" :key="contentTemplate.id" :label="contentTemplate.templateName" :value="contentTemplate.id"></el-option>
    </el-select>
  </el-form-item>
</el-form>

<el-tree
  ref="tree"
  :data="channels"
  :default-expanded-keys="expandedChannelIds"
  node-key="value"
  show-checkbox
  check-on-click-node
  check-strictly
  highlight-current
  class="tree"
  :filter-node-method="filterNode"
  v-on:check-change="handleCheckChange"
>
  <div slot-scope="{ node, data }">
    <el-link :underline="false" :href="getChannelUrl(data)" v-on:click.stop.native target="_blank"><i class="el-icon-link"></i></el-link>
    {{ data.label }} ({{data.count}})
    <el-tag size="mini">
      {{ getChannelTemplateName(data.channelTemplateId) }}
    </el-tag>
    <el-tag size="mini" type="success">
      {{ getContentTemplateName(data.contentTemplateId) }}
    </el-tag>
  </div>
</el-tree>

<div style="height: 10px"></div>
<el-divider></el-divider>
<div style="height: 10px"></div>

<el-form :inline="true" size="small">
  <el-form-item label="">
    <el-checkbox label="全选" v-on:change="selectAll" v-model="isAllChecked"></el-checkbox>
    <el-checkbox label="同时生成下级" v-model="isDescendent"></el-checkbox>
    <el-checkbox label="生成栏目页" v-model="isChannelPage"></el-checkbox>
    <el-checkbox label="生成内容页" v-model="isContentPage"></el-checkbox>
  </el-form-item>
  <el-form-item>
    <el-select v-model="scope">
      <el-option value="all" label="<不限>"></el-option>
      <el-option value="1month" label="一个月内更新内容的栏目"></el-option>
      <el-option value="1day" label="一天内更新内容的栏目"></el-option>
      <el-option value="2hours" label="2小时内更新内容的栏目"></el-option>
    </el-select>
  </el-form-item>
  <el-form-item>
    <el-button
    size="small"
    type="primary"
    :disabled="channelIds.length === 0 || (!isChannelPage && !isContentPage)"
    v-on:click="btnCreateClick">
    生 成
  </el-button>
  </el-form-item>
</el-form>

@section Scripts{
<script src="/sitefiles/assets/js/admin/cms/createPage.js" type="text/javascript"></script> }
